<template>
    <div class="app-container">
        <el-table v-adaptive :border="true" :data="outpFeesDetailList" :header-cell-style="$headerCellStyle" :stripe="true"
                  highlight-current-row @selection-change="handleSelectionChange">
            <el-table-column :align="'center'" type="selection" width="55"/>
            <el-table-column v-if="true" :align="'center'" label="主键" prop="outpFeesDetailId"/>
            <el-table-column :align="'center'" label="收费号" prop="feesNo"/>
            <el-table-column :align="'center'" label="流水号" prop="serialNo"/>
            <el-table-column :align="'center'" label="项目类型" prop="itemClass">
                <template #default="scope">
                    <dict-data-tag :options="dictDataMap['bill_item_class_dict']" :value="scope.row.itemClass"/>
                </template>
            </el-table-column>
            <el-table-column :align="'center'" label="项目名称" prop="itemName"/>
            <el-table-column :align="'center'" label="项目编码" prop="itemCode"/>
            <el-table-column :align="'center'" label="数量" prop="num"/>
            <el-table-column :align="'center'" label="单价" prop="price"/>
            <el-table-column :align="'center'" label="进货价格" prop="tradePrice"/>
            <el-table-column :align="'center'" label="网络价格" prop="networkPrice"/>
            <el-table-column :align="'center'" label="门诊费用分类" prop="classOnRcpt">
                <template #default="scope">
                    <dict-data-tag :options="dictDataMap['outp_rcpt_fee_dict']" :value="scope.row.classOnRcpt"/>
                </template>
            </el-table-column>
            <el-table-column :align="'center'" label="核算项目科目" prop="classOnReckoning">
                <template #default="scope">
                    <dict-data-tag :options="dictDataMap['reck_item_class_dict']" :value="scope.row.classOnReckoning"/>
                </template>
            </el-table-column>
            <el-table-column :align="'center'" label="会计科目" prop="subjCode">
                <template #default="scope">
                    <dict-data-tag :options="dictDataMap['tally_subject_dict']" :value="scope.row.subjCode"/>
                </template>
            </el-table-column>
            <el-table-column :align="'center'" label="应付费用" prop="costs"/>
            <el-table-column :align="'center'" label="实收费用" prop="charges"/>
            <el-table-column :align="'center'" label="舍入差额" prop="diffCost"/>
            <el-table-column :align="'center'" label="备注信息" prop="remarks"/>
        </el-table>

        <pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum"
                    :total="total" @pagination="getList"/>
    </div>
</template>
<script lang="ts">
export default {
    name: "OutpFeesDetail"
}
</script>

<script setup lang="ts">
import {
    addOutpFeesDetail,
    delOutpFeesDetail,
    getOutpFeesDetail,
    listOutpFeesDetail,
    updateOutpFeesDetail
} from "@/api/finance/outpFeesDetail";

import {useDictStoreHook} from "@/store/modules/dict";

const dictStore = useDictStoreHook();
let dictDataMap = ref(dictStore.isTypeGetData('tally_subject_dict', 'charge_flag_dict', 'bill_item_class_dict', 'outp_rcpt_fee_dict', 'reck_item_class_dict'))

const {proxy} = getCurrentInstance() as any;
const outpFeesDetailList = ref([]);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);


const queryParams = ref<OutpFeesDetail>({
    pageNum: 1,
    pageSize: 10,
    outpFeesDetailId: "",
    outpFeesMasterId: "",
    feesNo: "",
    serialNo: "",
    itemClass: "",
    packItemName: "",
    itemName: "",
    itemCode: "",
    priceId: "",
    num: 0,
    price: 0,
    tradePrice: 0,
    networkPrice: 0,
    classOnRcpt: "",
    classOnReckoning: "",
    subjCode: "",
    costs: 0,
    charges: 0,
    diffCost: 0,
    orgId: "",
    remarks: "",
    status: ""
})

/** 查询门诊收费记录明细列表 */
function getList() {
    listOutpFeesDetail(queryParams.value).then((response: any) => {
        outpFeesDetailList.value = response.rows;
        total.value = response.total;
    });
}

/** 搜索按钮操作 */
function handleQuery() {
    queryParams.value.pageNum = 1;
    getList();
}

// 多选框选中数据
function handleSelectionChange(selection) {
    ids.value = selection.map(item => item.outpFeesDetailId);
    single.value = selection.length != 1;
    multiple.value = !selection.length;
}

getList();
</script>
